# -*- coding: UTF-8 -*-
# @Author  : icedew
# @File    : Perfect_bbs.py
# @Time    : 2019-4-29 17:37
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_login import LoginManager

from apps.cms import bp as cms_bp
from apps.front import bp as front_bp
from apps.common import bp as common_bp
import config
from exts import db
from flask_wtf.csrf import CSRFProtect
from exts import mail
csrf = CSRFProtect()
bootstrap = Bootstrap()
def create_app():
    app = Flask(__name__)
    csrf.init_app(app)
    app.config.from_object(config)
    app.register_blueprint(cms_bp)
    app.register_blueprint(front_bp)
    app.register_blueprint(common_bp)
    db.init_app(app)
    bootstrap.init_app(app)
    mail.init_app(app)
    return app

if __name__ == '__main__':
    app = create_app()
    app.run()